home *** CD-ROM | disk | FTP | other *** search
- global gMANumMatches, gMAsound, gMALev, gMADebug
-
- on MAmovie
- global MAmenuList, MAnewGame, MASavedList, gHSState, gMAnextLev, gMAmenu, gMAgameMarker, gMALev, gMAsound, gMAflip, MAflavor
- set the exitLock to 1
- set gMADebug to 1
- EnableIdleAnim(47, 48)
- set gMANumMatches to -1
- puppetSprite(44, 1)
- set the visible of sprite 44 to 0
- set MAmenuList to [[#menu1a, #menu2a, #menu3a], [#menu1b, #menu2b, #menu3b], [#menu1c, #menu2c, #menu3c], [#menu1d, #menu2d, #menu3d]]
- set the keyDownScript to "MAcheckKey"
- set the text of cast "guessField" to " "
- set the textSize of field "guessField" to 12
- set the text of cast "guessField" to EMPTY
- set MASavedList to []
- set temp to HSStateGet("MA", "savedList")
- set MASavedList to value(temp)
- set temp to HSStateGet("MA", "NumMatches")
- set gMANumMatches to value(temp)
- if listp(MASavedList) = 0 then
- set MAnewGame to 1
- set gMAgameMarker to 0
- set gMALev to 1
- set gMAnextLev to 1
- set gMAsound to 1
- set gMAflip to 1
- set MAflavor to getAt(MAmenuList, 1)
- set gMAmenu to GetCurrMenu()
- MAinitGame()
- end if
- if listp(MASavedList) = 1 then
- MAgetStates()
- MAinitGame()
- end if
- set gMAflip to value(HSStateGet("opt", "MAFlip"))
- if gMAflip = 1 then
- set MAflavor to getAt(MAmenuList, 2)
- set gMAmenu to GetCurrMenu()
- end if
- if gMAflip = 0 then
- set MAflavor to getAt(MAmenuList, 4)
- set gMAmenu to GetCurrMenu()
- end if
- end
-
- on MAdoConButtons aForceMenu
- global gMAmenu, gMAcurrAth, gMAsound, gMAflip, gMALev, MAflavor, gMAnextLev, gSISystem, MAclearedGrid
- if voidp(aForceMenu) then
- set aForceMenu to 0
- end if
- StartBufferingEvents()
- repeat while aForceMenu or ((the mouseH > 0) and (the mouseH < 640) and (the mouseV < 16))
- if the mouseV < 0 then
- exit repeat
- end if
- if aForceMenu or ((the mouseH > 0) and (the mouseH < 640) and (the mouseV < 16)) then
- puppetSprite(44, 1)
- set the castNum of sprite 44 to gMAmenu
- updateStage()
- end if
- set the visible of sprite 44 to 1
- repeat while (the mouseH > 115) and (the mouseH < 205) and (the mouseV < 16)
- if (the mouseH > 115) and (the mouseH < 205) and (the mouseV < 16) then
- set the castNum of sprite 45 to the number of cast "how-hi.btn"
- end if
- updateStage()
- if the mouseDown then
- LaunchHelp()
- exit repeat
- end if
- end repeat
- repeat while (the mouseH > 0) and (the mouseH < 102) and (the mouseV < 16)
- if (the mouseH > 0) and (the mouseH < 102) and (the mouseV < 16) then
- set the castNum of sprite 45 to the number of cast "new puz-hi.btn"
- end if
- updateStage()
- if the mouseDown then
- puppetSprite(42, 0)
- puppetSprite(43, 0)
- puppetSprite(46, 0)
- updateStage()
- go("gameFrame")
- set the locH of sprite 1 to the locH of sprite 1
- updateStage()
- HSStatePut("ma", "not1stTime", "1")
- set the text of cast "guessField" to EMPTY
- MAinitGame()
- goSetUp(1)
- set the visible of sprite 44 to 1
- exit repeat
- end if
- end repeat
- repeat while (the mouseH > 225) and (the mouseH < 315) and (the mouseV < 16)
- if the frameLabel <> "gameFrame" then
- exit repeat
- end if
- if (the mouseH > 225) and (the mouseH < 315) and (the mouseV < 16) then
- set the castNum of sprite 45 to the number of cast "solve-hi.btn"
- end if
- updateStage()
- if the mouseDown then
- if not voidp(gMAcurrAth) then
- if gMANumMatches <> -1 then
- puppetSprite(40, 1)
- set the text of cast "guessField" to gMAcurrAth
- repeat with I = 16 to 39
- puppetSprite(I, 0)
- end repeat
- set MAclearedGrid to list(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
- if gMALev = 1 then
- MAshowLetters()
- end if
- MAdoHistory()
- end if
- end if
- exit repeat
- end if
- end repeat
- repeat while (the mouseH > 330) and (the mouseH < 420) and (the mouseV < 16) and (the mouseDown = 0)
- if gMAnextLev = 1 then
- if (the mouseH > 330) and (the mouseH < 420) and (the mouseV < 16) then
- set the castNum of sprite 45 to the number of cast "lev01-hi.btn"
- end if
- updateStage()
- end if
- if gMAnextLev = 2 then
- if (the mouseH > 330) and (the mouseH < 420) and (the mouseV < 16) then
- set the castNum of sprite 45 to the number of cast "lev02-hi.btn"
- end if
- updateStage()
- end if
- if gMAnextLev = 3 then
- if (the mouseH > 330) and (the mouseH < 420) and (the mouseV < 16) then
- set the castNum of sprite 45 to the number of cast "lev03-hi.btn"
- end if
- updateStage()
- end if
- if the mouseDown then
- set gMAnextLev to gMAnextLev + 1
- if gMAnextLev > 3 then
- set gMAnextLev to 1
- end if
- set gMAmenu to GetCurrMenu()
- if gMALev = 10 then
- set gMALev to 2
- set gMAmenu to GetCurrMenu()
- exit repeat
- end if
- if gMALev = 20 then
- set gMALev to 3
- set gMAmenu to GetCurrMenu()
- exit repeat
- end if
- if gMALev = 30 then
- set gMALev to 1
- set gMAmenu to GetCurrMenu()
- exit repeat
- end if
- updateStage()
- end if
- end repeat
- repeat while (the mouseH > 435) and (the mouseH < 530) and (the mouseV < 16) and (the mouseDown = 0)
- if gMAsound = 1 then
- if (the mouseH > 435) and (the mouseH < 530) and (the mouseV < 16) then
- set the castNum of sprite 45 to the number of cast "sound on-hi.btn"
- end if
- end if
- if gMAsound = 0 then
- if (the mouseH > 435) and (the mouseH < 530) and (the mouseV < 16) then
- set the castNum of sprite 45 to the number of cast "sound off-hi.btn"
- end if
- end if
- updateStage()
- if the mouseDown then
- if gMAsound = 1 then
- set gMAsound to 0
- set the soundEnabled to 0
- if gMAflip = 1 then
- set MAflavor to getAt(MAmenuList, 2)
- set gMAmenu to GetCurrMenu()
- exit repeat
- end if
- if gMAflip = 0 then
- set MAflavor to getAt(MAmenuList, 4)
- set gMAmenu to GetCurrMenu()
- exit repeat
- end if
- end if
- if gMAsound = 0 then
- set gMAsound to 1
- set the soundEnabled to 1
- if gMAflip = 1 then
- set MAflavor to getAt(MAmenuList, 1)
- set gMAmenu to GetCurrMenu()
- exit repeat
- end if
- if gMAflip = 0 then
- set MAflavor to getAt(MAmenuList, 3)
- set gMAmenu to GetCurrMenu()
- exit repeat
- end if
- end if
- updateStage()
- end if
- end repeat
- repeat while (the mouseH > 540) and (the mouseH < 640) and (the mouseV < 16) and (the mouseDown = 0)
- if gMAflip = 1 then
- if (the mouseH > 540) and (the mouseH < 640) and (the mouseV < 16) then
- set the castNum of sprite 45 to the number of cast "flip on-hi.btn"
- end if
- end if
- if gMAflip = 0 then
- if (the mouseH > 540) and (the mouseH < 640) and (the mouseV < 16) then
- set the castNum of sprite 45 to the number of cast "flip off-hi.btn"
- end if
- end if
- updateStage()
- if the mouseDown then
- if gMAflip = 1 then
- HSStatePut("opt", "MAFlip", "0")
- set gMAflip to 0
- if gMAsound = 1 then
- set MAflavor to getAt(MAmenuList, 3)
- set gMAmenu to GetCurrMenu()
- exit repeat
- end if
- if gMAsound = 0 then
- set MAflavor to getAt(MAmenuList, 4)
- set gMAmenu to GetCurrMenu()
- exit repeat
- end if
- end if
- if gMAflip = 0 then
- HSStatePut("opt", "MAFlip", "1")
- set gMAflip to 1
- if gMAsound = 1 then
- set MAflavor to getAt(MAmenuList, 1)
- set gMAmenu to GetCurrMenu()
- exit repeat
- end if
- if gMAsound = 0 then
- set MAflavor to getAt(MAmenuList, 2)
- set gMAmenu to GetCurrMenu()
- exit repeat
- end if
- end if
- updateStage()
- end if
- end repeat
- if aForceMenu then
- exit repeat
- end if
- end repeat
- repeat while (the mouseH > 361) and (the mouseH < 455) and (the mouseV > 455)
- if (the mouseH > 361) and (the mouseH < 455) and (the mouseV > 455) then
- set the castNum of sprite 46 to the number of cast "guess-hi.btn"
- end if
- updateStage()
- if the mouseDown then
- MAdoGuess()
- updateStage()
- end if
- end repeat
- EndBufferingEvents()
- if not aForceMenu then
- set the visible of sprite 44 to 0
- end if
- end
-
- on MAcheckKey
- if (the key = RETURN) or (the key = ENTER) then
- MAdoGuess()
- else
- if gMAsound then
- puppetSound("type.aif")
- updateStage()
- end if
- end if
- if (the text of cast "guessField" = RETURN) or (the text of cast "guessField" = ENTER) then
- set the text of cast "guessField" to EMPTY
- end if
- end
-
- on MAdoGuess
- global gMAcurrAth, gMAgameMarker, MAclearedGrid
- if gMAsound then
- puppetSound("return.aif")
- updateStage()
- end if
- set vTmp to the text of cast "guessField"
- if the text of cast "guessField" = gMAcurrAth then
- set gMAgameMarker to gMAgameMarker + 1
- repeat with vMAi = 16 to 39
- set the loc of sprite vMAi to point(-500, -500)
- puppetSprite(vMAi, 0)
- end repeat
- set MAclearedGrid to list(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
- if gMAsound then
- puppetSound("Ding.aif")
- updateStage()
- end if
- set the visible of sprite 43 to 0
- set the visible of sprite 42 to 0
- MAshowLetters()
- MAdoHistory()
- else
- beep()
- set the selStart to 0
- set the text of cast "guessField" to EMPTY
- put EMPTY before char 1 of field "guessField"
- end if
- end
-
- on MAdoHistory
- global gMAathStr
- puppetSprite(41, 0)
- set the visible of sprite 41 to 1
- set the visible of sprite 43 to 0
- set the visible of sprite 42 to 0
- set gMANumMatches to -1
- puppetSprite(42, 1)
- puppetSprite(43, 1)
- set the stretch of sprite 43 to 0
- put gMAathStr && the number of cast string("HS" & gMAathStr & ".pct")
- set the castNum of sprite 43 to the number of cast string("HS" & gMAathStr & ".pct")
- set the locH of sprite 43 to 209
- set the locV of sprite 43 to 201
- set the castNum of sprite 42 to the number of cast string("MA" & gMAathStr)
- set the locH of sprite 42 to 293
- set the locV of sprite 42 to 125
- go("Solved")
- end
-
- on MAtimer ticks
- startTimer()
- repeat while the timer < ticks
- nothing()
- end repeat
- end
-
- on MAturnPuppets aMAlow, aMAhigh, aMAway
- repeat with N = aMAlow to aMAhigh
- puppetSprite(N, aMAway)
- end repeat
- end
-
- on MAturnVisible aMAlow, aMAhigh, aMAway
- repeat with N = aMAlow to aMAhigh
- MAturnPuppets(N, N, aMAway)
- set the visible of sprite N to aMAway
- end repeat
- end
-
- on MAinitGame
- global gMAnextLev, gMALev, MAgridList, gMAlowSprite, gMAhighSprite, gMAlowLetterSprite, gMAmatch, MAclearedGrid
- if gMAnextLev > 0 then
- set gMALev to gMAnextLev
- else
- set gMALev to 1
- end if
- MAallOFF()
- doMAathList()
- set MAgridList to [point(77, 55), point(174, 55), point(271, 55), point(368, 55), point(465, 55), point(562, 55), point(77, 156), point(174, 156), point(271, 156), point(368, 156), point(465, 156), point(562, 156), point(77, 257), point(174, 257), point(271, 257), point(368, 257), point(465, 257), point(562, 257), point(77, 358), point(174, 358), point(271, 358), point(368, 358), point(465, 358), point(562, 358)]
- set gMAlowSprite to 16
- set gMAhighSprite to 39
- set gMAlowLetterSprite to 2
- set gMAmatch to EMPTY
- set MAclearedGrid to list()
- repeat with N = 1 to 24
- append(MAclearedGrid, 1)
- end repeat
- MAdoAnimList()
- end
-
- on MAsetTile aMAwhichTile, aMAwhatNum, aAltSprite
- global gMAlowSprite, MAgridList
- if voidp(aAltSprite) then
- puppetSprite(aMAwhichTile + gMAlowSprite - 1, 1)
- set the castNum of sprite (aMAwhichTile + gMAlowSprite - 1) to cast aMAwhatNum
- set the loc of sprite (aMAwhichTile + gMAlowSprite - 1) to getAt(MAgridList, aMAwhichTile)
- else
- puppetSprite(aAltSprite, 1)
- set the stretch of sprite aAltSprite to 0
- set the castNum of sprite aAltSprite to cast aMAwhatNum
- set the loc of sprite aAltSprite to getAt(MAgridList, aMAwhichTile)
- set the visible of sprite aAltSprite to 1
- end if
- end
-
- on MAunCover aMAwhichOne, aMAcolor
- global gMAmatch, gMAlowSprite, gMAoldOne, MAanswergridList, MAclearedGrid, gOldvRot, gMAflip, gMAcurNameLength, MAuniqCharList, gMANumMatches, MAanimList
- set aMAplaceOnGrid to aMAwhichOne - gMAlowSprite + 1
- MAdoAnim(aMAplaceOnGrid, aMAcolor, 0)
- if gMAmatch = EMPTY then
- set gMAmatch to getAt(MArandomGridlist, aMAplaceOnGrid)
- set gMAoldOne to aMAwhichOne
- set gOldvRot to integer(aMAcolor)
- else
- MAtimer(40)
- set aMAright to MAcheckMatch(getAt(MArandomGridlist, aMAplaceOnGrid), gMAmatch)
- set the visible of sprite 41 to 0
- set the visible of sprite 42 to 0
- if aMAright = 1 then
- if gMAsound then
- puppetSound("zap.aif")
- updateStage()
- end if
- setAt(MAclearedGrid, aMAwhichOne - gMAlowSprite + 1, 0)
- setAt(MAclearedGrid, gMAoldOne - gMAlowSprite + 1, 0)
- MAshowLetters()
- if the castNum of sprite 1 = 8 then
- set the castNum of sprite 1 to 13
- else
- set the castNum of sprite 1 to 8
- end if
- updateStage()
- set the locH of sprite aMAwhichOne to -2000
- set the locH of sprite gMAoldOne to -2000
- set gMANumMatches to gMANumMatches + 1
- put "DUCK" && gMANumMatches && count(MAuniqCharList)
- if (gMANumMatches >= count(MAuniqCharList)) and (gMALev = 1) then
- put "DUCK!!"
- MAdoHistory()
- end if
- else
- put "Duck2"
- put aMAcolor
- if gMAsound then
- puppetSound("wssht.aif")
- updateStage()
- end if
- MAdoAnim(aMAplaceOnGrid, aMAcolor, 1)
- set vRot to integer(aMAcolor)
- MAsetTile(aMAwhichOne - gMAlowSprite + 1, getAt(getAt(MAanimList, vRot), 1))
- put aMAcolor
- MAdoAnim(gMAoldOne - gMAlowSprite + 1, aMAcolor, 1)
- MAsetTile(gMAoldOne - gMAlowSprite + 1, getAt(getAt(MAanimList, gOldvRot), 1))
- put aMAcolor
- set the visible of sprite 41 to 0
- set the visible of sprite 42 to 0
- end if
- set gMAmatch to EMPTY
- end if
- end
-
- on MAdoAnim aMAwhere, aMAwhichColor, aMAbackward
- global MAanswergridList, MAanimList, gMAlowSprite, gMAflip, gMAmatch
- if gMAsound then
- puppetSound("flip.aif")
- end if
- if gMAflip = 1 then
- if aMAbackward = 1 then
- repeat with N = 6 down to 2
- MAsetTile(aMAwhere, getAt(getAt(MAanimList, aMAwhichColor), N))
- updateStage()
- MAtimer(3)
- end repeat
- else
- repeat with N = 1 to 6
- MAsetTile(aMAwhere, getAt(getAt(MAanimList, aMAwhichColor), N))
- updateStage()
- MAtimer(5)
- end repeat
- set the trails of sprite (aMAwhere + gMAlowSprite - 1) to 1
- MAsetTile(aMAwhere, getAt(getAt(MAanimList, aMAwhichColor), 7))
- updateStage()
- MAsetTile(aMAwhere, getProp(MAuniqueIconList, getaProp(MAanswergridList, aMAwhere)), 41 + (gMAmatch = EMPTY))
- end if
- set the trails of sprite (aMAwhere + gMAlowSprite - 1) to 0
- updateStage()
- end if
- if gMAflip = 0 then
- MAsetTile(aMAwhere, getAt(getAt(MAanimList, aMAwhichColor), 7))
- updateStage()
- MAsetTile(aMAwhere, getProp(MAuniqueIconList, getaProp(MAanswergridList, aMAwhere)), 41 + (gMAmatch = EMPTY))
- updateStage()
- end if
- end
-
- on MAcheckMatch aMAisThis, aMAthis
- set aMAright to 0
- if aMAisThis = aMAthis then
- set aMAright to 1
- else
- set aMAright to 0
- end if
- return aMAright
- end
-
- on MAshowLetters
- global gMAcurrAth, MAanswergridList, MAclearedGrid, gMAlowLetterSprite, gMAcurNameLength, gMALev, gMAblanks, gMAspacelessName
- repeat with N = 1 to 24
- if getAt(MAclearedGrid, N) = 0 then
- repeat with X = 1 to gMAcurNameLength + gMAblanks
- if gMALev <> 2 then
- if char X of gMAcurrAth = string(getAt(MAanswergridList, N)) then
- if gMALev < 3 then
- puppetSprite(X + gMAlowLetterSprite - 1, 1)
- set the castNum of sprite (X + gMAlowLetterSprite - 1) to cast getAt(MAanswergridList, N)
- if gMAsound then
- puppetSound("pong.aif")
- updateStage()
- end if
- end if
- if gMALev > 2 then
- set the loc of sprite (X + gMAlowLetterSprite - 1) to point(5 + (X * 33), 464)
- if gMAsound then
- puppetSound("pong.aif")
- updateStage()
- end if
- end if
- end if
- end if
- if gMALev = 2 then
- if char X of gMAspacelessName = string(getAt(MAanswergridList, N)) then
- puppetSprite(X + gMAlowLetterSprite - 1, 1)
- set the castNum of sprite (X + gMAlowLetterSprite - 1) to cast getAt(MAanswergridList, N)
- if gMAsound then
- puppetSound("pong.aif")
- updateStage()
- end if
- end if
- end if
- end repeat
- end if
- end repeat
- end
-
- on makeAnswerGridList fromWhatList
- global MAuniqueIconList
- set thisList to list()
- repeat with N = 1 to 24
- if getAt(fromWhatList, N) > 0 then
- append(thisList, string(getPropAt(MAuniqueIconList, getAt(fromWhatList, N))))
- next repeat
- end if
- append(thisList, 0)
- end repeat
- return thisList
- end
-
- on makeRandomGrid withHowMany
- set usedList to [:]
- repeat with N = 1 to 24
- addProp(usedList, N, 0)
- end repeat
- set N to 1
- repeat while N < (withHowMany + 1)
- set try to EMPTY
- repeat while try = EMPTY
- set try to random(24)
- if getAt(usedList, try) = 0 then
- setAt(usedList, try, N)
- set try to EMPTY
- repeat while try = EMPTY
- set try to random(24)
- if getAt(usedList, try) = 0 then
- setAt(usedList, try, N)
- set N to N + 1
- next repeat
- end if
- set try to EMPTY
- end repeat
- next repeat
- end if
- set try to EMPTY
- end repeat
- end repeat
- return usedList
- end
-
- on MAallOFF
- MAturnPuppets(1, 48, 1)
- MAturnVisible(1, 48, 1)
- MAturnPuppets(1, 48, 0)
- end
-
- on tellLoc
- repeat with N = 16 to 39
- put the loc of sprite N
- end repeat
- end
-
- on goSetUp MAnewGame
- global MAgridList, gMAlowSprite, gMAlowLetterSprite, gMAcurrAth, MAathList, MAunusedAthList, gMAcurNameLength, gMAblanks, gMAcurrAthNum, MAuniqCharList, gMAspacelessName, MAflavor, MAmenuList, mouseUp, gMAnextLev, gMAathStr, mouseUp, gMALev
- clearBoard()
- set gMALev to gMAnextLev
- if MAnewGame = 1 then
- set gMANumMatches to 0
- set MAunusedAthList to value(string(MAathList))
- set N to count(MAunusedAthList)
- set vMArandomAthlete to random(N)
- set gMAcurrAth to getPropAt(MAunusedAthList, vMArandomAthlete)
- set gMAcurrAthNum to getAt(MAunusedAthList, vMArandomAthlete)
- set MAflavor to getAt(MAmenuList, 1)
- end if
- set gMAspacelessName to gMAcurrAth
- repeat with I = 1 to length(gMAspacelessName)
- if char I of gMAspacelessName = " " then
- delete char I of gMAspacelessName
- end if
- end repeat
- if gMALev = 2 then
- set vMAname to gMAspacelessName
- set vMAnum to length(gMAspacelessName)
- set X to EMPTY
- repeat with I = 1 to length(gMAspacelessName)
- set N to random(vMAnum)
- set X to char N of vMAname
- delete char N of vMAname
- set vMAscrambledName to string(vMAscrambledName & X)
- set vMAnum to vMAnum - 1
- end repeat
- set gMAspacelessName to vMAscrambledName
- end if
- set gMAathStr to string(gMAcurrAthNum)
- if length(gMAathStr) = 1 then
- set gMAathStr to string("00" & gMAcurrAthNum)
- else
- if length(gMAathStr) = 2 then
- set gMAathStr to string("0" & gMAcurrAthNum)
- end if
- end if
- setUpCards(MAnewGame)
- if gMALev <> 2 then
- set theChar to char 1 of gMAcurrAth
- set N to 1
- set vMAblankCount to 0
- repeat while theChar <> EMPTY
- puppetSprite(N + gMAlowLetterSprite - 1, 1)
- if char N of gMAcurrAth = " " then
- set the castNum of sprite (N + gMAlowLetterSprite - 1) to cast string("blank")
- set vMAblankCount to vMAblankCount + 1
- else
- set the castNum of sprite (N + gMAlowLetterSprite - 1) to cast string("dash")
- end if
- if gMALev < 2 then
- set the loc of sprite (N + gMAlowLetterSprite - 1) to point(5 + (N * 33), 464)
- end if
- if gMALev > 2 then
- set the loc of sprite (N + gMAlowLetterSprite - 1) to point(5 + (N * 33), 1000)
- else
- if gMAsound then
- puppetSound("schwak.aif")
- updateStage()
- end if
- updateStage()
- set vNewTime to the timer + 15
- repeat while the timer < vNewTime
- nothing()
- end repeat
- end if
- set N to N + 1
- set theChar to char N of gMAcurrAth
- end repeat
- end if
- if gMALev = 2 then
- set theChar to char 1 of gMAspacelessName
- set N to 1
- set vMAblankCount to 0
- repeat while theChar <> EMPTY
- puppetSprite(N + gMAlowLetterSprite - 1, 1)
- set the castNum of sprite (N + gMAlowLetterSprite - 1) to cast string("dash")
- set the loc of sprite (N + gMAlowLetterSprite - 1) to point(5 + (N * 33), 464)
- set N to N + 1
- set theChar to char N of gMAspacelessName
- end repeat
- end if
- set gMAcurNameLength to N - 1 - vMAblankCount
- set gMAblanks to vMAblankCount
- end
-
- on setUpCards MAnewGame
- global uniquePairList, MAuniqueIconList, gMAcurNameLength, MArandomGridlist, MAanswergridList, MAclearedGrid, MAcharList, gMAcurrAth, gMAspacelessName, gMALev, MAuniqCharList
- if MAnewGame = 1 then
- set MAcharList to []
- set vMAcharNums to length(gMAspacelessName)
- repeat with vMAi = 1 to vMAcharNums
- append(MAcharList, char vMAi of gMAspacelessName)
- end repeat
- set vMAnum to length(gMAspacelessName)
- set MAuniqCharList to []
- repeat with vMAi = 1 to vMAnum
- set vChr to char vMAi of gMAspacelessName
- set vFlag to 1
- repeat with vMAn = vMAi - 1 down to 1
- if vChr = char vMAn of gMAspacelessName then
- set vFlag to 0
- exit repeat
- end if
- end repeat
- if vFlag then
- add(MAuniqCharList, vChr)
- end if
- end repeat
- MAdoUniqueIconList()
- set MArandomGridlist to makeRandomGrid(count(MAuniqueIconList))
- set MAanswergridList to makeAnswerGridList(MArandomGridlist)
- end if
- repeat with N = 1 to count(MAuniqueIconList)
- set a to 0
- set X to 0
- repeat while a = 0
- set X to X + 1
- set a to getAt(MArandomGridlist, X)
- if a = N then
- set a to X
- next repeat
- end if
- set a to 0
- end repeat
- set b to 0
- repeat while b = 0
- set X to X + 1
- set b to getAt(MArandomGridlist, X)
- if b = N then
- set b to X
- next repeat
- end if
- set b to 0
- end repeat
- if getAt(MAclearedGrid, a) = 1 then
- set num to getAt(getAt(MAanimList, integer(char 8 of the name of cast getAt(MAuniqueIconList, N))), 1)
- MAsetTile(a, num)
- if gMAsound then
- puppetSound("deal.aif")
- end if
- updateStage()
- set vNewTime to the timer + 15
- repeat while the timer < vNewTime
- nothing()
- end repeat
- MAsetTile(b, num)
- if gMAsound then
- puppetSound("deal.aif")
- end if
- end if
- updateStage()
- set vNewTime to the timer + 15
- repeat while the timer < vNewTime
- nothing()
- end repeat
- end repeat
- end
-
- on GetCurrMenu
- global gMAnextLev, gMAsound, gMAflip
- set vMenu to "menu" & gMAnextLev
- if gMAsound then
- if gMAflip then
- set vSfx to "a"
- else
- set vSfx to "c"
- end if
- else
- if gMAflip then
- set vSfx to "b"
- else
- set vSfx to "d"
- end if
- end if
- set vMenu to vMenu & vSfx
- return the number of cast vMenu
- end
-